// UVa122 Trees on the level
// 陈锋
#include <bits/stdc++.h>
using namespace std;
#define _for(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long LL;
struct Node {
  Node* ch[2];
  int val;
  bool hasValue;
  Node() : val(0), hasValue(false) { ch[0] = ch[1] = nullptr; }
};
typedef Node* PNode;
bool insert(PNode p, int val, const char* path) {
  assert(p);
  int len = strlen(path);
  _for(i, 0, len) {
    char c = path[i];
    int b = c == 'R';
    if (!p->ch[b]) p->ch[b] = new Node();
    p = p->ch[b];
  }
  p->val = val;
  if (p->hasValue) return false;
  return p->hasValue = true;
}

bool bfs(PNode p, vector<int>& ans) {
  queue<PNode> Q;
  ans.clear(), Q.push(p);
  while (!Q.empty()) {
    p = Q.front();
    Q.pop();
    if (!p->hasValue) return false;
    ans.push_back(p->val);
    if (p->ch[0]) Q.push(p->ch[0]);
    if (p->ch[1]) Q.push(p->ch[1]);
  }
  return true;
}

int main() {
  char s[512];
  int v;
  vector<int> ans;
  while (true) {
    Node nd, *root = &nd;
    bool valid = true;
    while (true) {
      if (scanf("%s", s) != 1) return 0;
      if (strcmp(s, "()") == 0) break;
      sscanf(s + 1, "%d", &v);
      if (!insert(root, v, strchr(s, ',') + 1)) valid = false;
    }
    if (valid && bfs(root, ans))
      for (size_t i = 0; i < ans.size(); i++)
        printf("%d%s", ans[i], (i == ans.size() - 1 ? "\n" : " "));
    else
      puts("not complete");
  }
  return 0;
}
/*
算法分析请参考: 《入门经典-第2版》例题6-7
*/
// 24467945 122 Trees on the level  Accepted  C++11 0.000 2020-01-25 13:35:17